import { darkTheme, lightTheme, type GlobalTheme } from 'naive-ui'
// import { useMainDataStore } from '@/store/mainData'
// TODO: 只要导入并声明就会报错, 即便不使用
// const mainData = useMainDataStore()
// Uncaught Error: [🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
// See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
// This will fail in production.
//     at useStore (pinia.mjs:1709

// 后续 控制系统主题的 变量要移动到 store 中
// const isDark = ref(mainData.sysTheme)
const isDark = ref(false)

export const theme = ref<null | GlobalTheme>(null)
export const changeTheme = () => {
  isDark.value = !isDark.value
  if (isDark.value) {
    theme.value = darkTheme
  } else {
    theme.value = lightTheme
  }
}
